#include "../func.h"

void* threadfunc(void* p)
{
    char* p1 = (char*)p;
    p1 = (char*)malloc(20);
    strcpy(p1, "hello");
    pthread_exit(p1);
}

int main()
{
    pthread_t pthid;
    int ret;
    ret = pthread_create(&pthid, NULL, threadfunc, NULL);
    if (0 != ret)
    {
        printf("pthread_create failed ret = %d\n", ret);
        return -1;
    }
    char* p;
    ret = pthread_join(pthid, (void**)&p);
    if (0 != ret)
    {
        printf("pthread_join failed ret = %d\n", ret);
        return -1;
    }
    printf("I am main thread, %s\n", p);

    sleep(1);
}
